﻿using NSwag.Annotations;

namespace Video.Application.Contract.Base;

public class PagedRequestDto
{
    private int _page = 1;
    private int _pageSize = 20;

    public int Page
    {
        get => _page;
        set => _page = value <= 0 ? 1 : value;
    }

    public int PageSize
    {
        get => _pageSize;
        set => _pageSize = value <= 0 ? 20 : value;
    }

    [OpenApiIgnore]
    public new int SkipCount => (Page - 1) * MaxResultCount;

    [OpenApiIgnore]
    public new int MaxResultCount =>
        PageSize > 1000 ? 1000 : PageSize;
}
